<%@ page language="java" contentType="text/html; charset=UTF-8"
	isELIgnored="false" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="f"%>
<%@ taglib uri="/mytag" prefix="yjd"%>
<div class="wrap">
	<div class="nav">
		<div class="return">
			<a href='<yjd:url url="/db/biEtlFromtableTotable/list"/>'>返回上一级</a>
		</div>
	</div>
	<div style="font-size:16px; font-weight: bold; color:red;">
	使用说明(必看)：
	在使用当前页功能之前，需请确保几点
	<ol style="list-style:disc;">
	<li>
	业务库中的来源表配置了修改和删除数据的触发器<br>
	<pre style="font-style:italic; font-size:15px; color:#333; font-weight:normal;">
创建触发器的代码：
create trigger 表名_trigger_insert
after insert on 表名
FOR EACH ROW
begin
INSERT INTO bi_changelog_yijiedai_com.yjd_data_change_record (database_code, table_name, ref_id, type, create_time, status, actual_dispose_time, version) VALUES ('所在业务库编码', '表名', new.主键名称, 1, unix_timestamp(now()), 0, 0, 1);
end;

create trigger 表名_trigger_delete
after delete on 表名
FOR EACH ROW
begin
INSERT INTO bi_changelog_yijiedai_com.yjd_data_change_record (database_code, table_name, ref_id, type, create_time, status, actual_dispose_time, version) VALUES ('所在业务库编码', '表名', old.主键名称, 2, unix_timestamp(now()), 0, 0, 1);
end;

create trigger 表名_trigger_update
after update on 表名
FOR EACH ROW
begin
INSERT INTO bi_changelog_yijiedai_com.yjd_data_change_record (database_code, table_name, ref_id, type, create_time, status, actual_dispose_time, version) VALUES ('所在业务库编码', '表名', old.主键名称, 3, unix_timestamp(now()), 0, 0, 1);
end;
业务库编码：对应数据源中的编码列
</pre>
	
	</li>
	<li>目标表在目标库必须存在</li>
	<li>来源表和目标表的结构必须一致</li>
	<li>若开启了抽取功能，后台自动将来源表数据抽取到目标库（包含变化中的数据，可能会有一些延迟）</li>
	</ol>
	</div>
	<form method="post" action='<yjd:url url="/db/biEtlFromtableTotable/save"/>' class="J_ajaxForm" autocomplete="off">
		<input type="hidden" name="id" value="${biEtlFromtableTotableModel.id }">
		<div class="h_a">业务数据抽取到bi库配置</div>
		<div class="table_full">
			<table width="100%">
				<tr>
					<th width="100">来源表</th>
					<td>
					数据源:<br/>
					<select id="from_database" class="mr10 length_6">
						<c:forEach items="${requestScope.biDatabaseInfoModels }" var="item">
						<c:if test="${item.bs_type==1 }">
						<option ${biEtlFromtableTotableModel.database_info_id==item.id?"selected='selected'":"" } value="${item.id }">${item.title }</option>
						</c:if>
						</c:forEach>
					</select>
					<br />表清单：<br />
					<select	name="from_table_id" id="from_table" class="mr10 length_6" size="10">
					</select>
					</td>
				</tr>
				<tr>
					<th>目标表</th>
					<td>
					数据源:<br/>
					<select id="to_database" class="mr10 length_6">
						<c:forEach items="${requestScope.biDatabaseInfoModels }" var="item">
						<c:if test="${item.bs_type==2 }">
						<option ${biEtlFromtableTotableModel.database_info_id==item.id?"selected='selected'":"" } value="${item.id }">${item.title }</option>
						</c:if>
						</c:forEach>
					</select>
					<br />表清单：<br />
					<select	name="to_table_id" id="to_table" class="mr10 length_6" size="10">
					</select>
					</td>
				</tr>
				<tr>
					<th>是否开启抽取</th>
					<td>
					<select	name="is_activie" class="mr20">
						<option value="0" ${model.is_activie==0?"selected='selected'":"" }>否</option>
						<option value="1" ${model.is_activie==1?"selected='selected'":"" }>是</option>
					</select> 
					</td>
				</tr>
			</table>
		</div>
		<div class="btn_wrap">
			<div class="btn_wrap_pd">
				<button class="btn btn_submit mr10 J_ajax_submit_btn" type="submit">提交</button>
			</div>
		</div>
	</form>
	<!-- end -->
</div>